using UnityEngine;

public class SkillLevelDisplay : MonoBehaviour
{
	public UILabel nameLabel;

	public UISprite fillSprite;

	public UILabel countLabel;

	public UISprite gainFillSprite;

	public int skillTypeIndex { get; protected set; }

	public PlayerStatsManager character { get; protected set; }

	public void Init(PlayerStatsManager character, PlayerStatsManager.SkillType skillType)
	{
		this.character = character;
		skillTypeIndex = (int)skillType;
		PlayerStats playerStats = character.playerStats;
		SkillDescription skillDescrption = character.playerStats.skillConfig.GetSkillDescrption(skillTypeIndex);
		UITools.ChangeText(nameLabel, skillDescrption.name);
		fillSprite.fillAmount = Mathf.Lerp(0.05f, 1f, playerStats.GetFillProgress(skillTypeIndex));
		gainFillSprite.fillAmount = 0f;
		UITools.ChangeText(countLabel, playerStats.GetSkillValueCountString(skillTypeIndex).ToString());
	}

	public void SetGainFill(float gain)
	{
		PlayerStats playerStats = character.playerStats;
		UITools.ChangeText(countLabel, playerStats.GetSkillValueCountString(skillTypeIndex, gain).ToString());
		gainFillSprite.fillAmount = Mathf.Lerp(0.05f, 1f, playerStats.GetFillProgress(skillTypeIndex, gain));
	}
}
